<?php
namespace application\admin\controller;
use application\common\controller\Base;
use think\Controller;

class Index extends Base
{
	public function index()
	{
//	    $ch = curl_init();
//	    $url = 'http://cs.henu.edu.cn/former/teacher_list1/18';
//	    curl_setopt($ch, CURLOPT_URL, $url);
//	    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//	    $content = curl_exec($ch);
//	    preg_match_all('/<a[^>]*?href=[\'\"]([^>]*?)>(.*?)<\/a>.*?\(([^\)]*?)\)/', $content, $messages);
		$ch = curl_init();
		$url = 'http://www.neea.edu.cn/html1/folder/16093/614-1.htm';
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		$content = curl_exec($ch);
		preg_match_all('/<a[^>]*?href=[\'\"]([^>\'\"]*?)[\'\"].*?title=[\'\"][^>\'\"]*?[\'\"]>(.*?)<\/a>\s*<\/span>\s*<span\s+id=[\'\"][^>\'\"]*?[\'\"]>(.*?)<\/span>/', $content, $messages);
		$this->assign([
			'active' => [-1,-1],
			'title' => '管理员主页',
			'messageCount' => 0,
//            'length' => count($messages[1]),
//            'link' => $messages[1],
//            'teacherName' => $messages[2],
//            'teacherTitle' => $messages[3],
            'length' => count($messages[1]),
            'link' => $messages[1],
            'notifies' => $messages[2],
            'times' => $messages[3],
		]);
		return $this->fetch();
	}
}